#include "060_medium.hpp"

#include <algorithm>
#include <catch2/catch.hpp>

using namespace jianzhi_060;

TEST_CASE("060", "[JIANZHI2][060]")
{

SECTION("060")
{
    {
        std::vector<int> ans{1,1,1,2,2,3};
        ans = Solution().topKFrequent(ans, 2);
        std::sort(ans.begin(), ans.end());
        CHECK(ans == std::vector{1,2});
    }

    {
        std::vector<int> ans{1};
        ans = Solution().topKFrequent(ans, 1);
        std::sort(ans.begin(), ans.end());
        CHECK(ans == std::vector{1});
    }

    {
        std::vector<int> ans{1,1,1,2,2,3};
        ans = Solution().topKFrequent2(ans, 2);
        std::sort(ans.begin(), ans.end());
        CHECK(ans == std::vector{1,2});
    }

    {
        std::vector<int> ans{1};
        ans = Solution().topKFrequent2(ans, 1);
        std::sort(ans.begin(), ans.end());
        CHECK(ans == std::vector{1});
    }
}

}
